package design.singleton;

import java.util.Optional;

/**
 * <p>
 * 懒汉式单例模式实现：
 * 延迟加载
 * 线程不完全
 * 实现容易
 *
 * </P>
 *
 * @author dingwen
 * @date 2021.10.14 15:43
 */
public class Singleton1 {
    private static Singleton1 instance;

    private Singleton1() {
    }

    public static Singleton1 getInstance() {
        return Optional.ofNullable(instance).orElseGet(Singleton1::new);
    }
}
